package org.jivesoftware.smack;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.filter.PacketIDFilter;
import org.jivesoftware.smack.packet.Bind;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.packet.Session;
import org.jivesoftware.smack.sasl.SASLAnonymous;
import org.jivesoftware.smack.sasl.SASLCramMD5Mechanism;
import org.jivesoftware.smack.sasl.SASLDigestMD5Mechanism;
import org.jivesoftware.smack.sasl.SASLExternalMechanism;
import org.jivesoftware.smack.sasl.SASLGSSAPIMechanism;
import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.sasl.SASLPlainMechanism;

public class SASLAuthentication
  implements UserAuthentication
{
  private static Map<String, Class> implementedMechanisms = new HashMap();
  private static List<String> mechanismsPreferences = new ArrayList();
  private Connection connection;
  private SASLMechanism currentMechanism;
  private String errorCondition;
  private boolean resourceBinded;
  private boolean saslFailed;
  private boolean saslNegotiated;
  private Collection<String> serverMechanisms = new ArrayList();
  private boolean sessionSupported;

  static
  {
    registerSASLMechanism("EXTERNAL", SASLExternalMechanism.class);
    registerSASLMechanism("GSSAPI", SASLGSSAPIMechanism.class);
    registerSASLMechanism("DIGEST-MD5", SASLDigestMD5Mechanism.class);
    registerSASLMechanism("CRAM-MD5", SASLCramMD5Mechanism.class);
    registerSASLMechanism("PLAIN", SASLPlainMechanism.class);
    registerSASLMechanism("ANONYMOUS", SASLAnonymous.class);
    supportSASLMechanism("DIGEST-MD5", 0);
    supportSASLMechanism("PLAIN", 1);
    supportSASLMechanism("ANONYMOUS", 2);
  }

  SASLAuthentication(Connection paramConnection)
  {
    this.currentMechanism = null;
    this.connection = paramConnection;
    init();
  }

  private String bindResourceAndEstablishSession(String paramString)
    throws XMPPException
  {
    long l;
    monitorenter;
    try
    {
      label10: throw new XMPPException("Resource binding not offered by server");
    }
    finally
    {
      try
      {
        super.wait(Math.abs(System.currentTimeMillis() - l));
      }
      catch (InterruptedException localInterruptedException)
      {
        break label10:
        localObject = finally;
        monitorexit;
        throw localObject;
      }
      Bind localBind1 = new Bind();
      localBind1.setResource(paramString);
      PacketCollector localPacketCollector1 = this.connection.createPacketCollector(new PacketIDFilter(localBind1.getPacketID()));
      this.connection.sendPacket(localBind1);
      Bind localBind2 = (Bind)localPacketCollector1.nextResult(SmackConfiguration.getPacketReplyTimeout());
      localPacketCollector1.cancel();
      if (localBind2 == null)
        throw new XMPPException("No response from the server.");
      if (localBind2.getType() == IQ.Type.ERROR)
        throw new XMPPException(localBind2.getError());
      String str = localBind2.getJid();
      if (this.sessionSupported)
      {
        Session localSession = new Session();
        PacketCollector localPacketCollector2 = this.connection.createPacketCollector(new PacketIDFilter(localSession.getPacketID()));
        this.connection.sendPacket(localSession);
        IQ localIQ = (IQ)localPacketCollector2.nextResult(SmackConfiguration.getPacketReplyTimeout());
        localPacketCollector2.cancel();
        if (localIQ == null)
          throw new XMPPException("No response from the server.");
        if (localIQ.getType() != IQ.Type.ERROR)
          break label293;
        throw new XMPPException(localIQ.getError());
      }
      throw new XMPPException("Session establishment not offered by server");
      label293: return str;
    }
  }

  public static List<Class> getRegisterSASLMechanisms()
  {
    ArrayList localArrayList = new ArrayList();
    Iterator localIterator = mechanismsPreferences.iterator();
    while (true)
    {
      if (!(localIterator.hasNext()))
        return localArrayList;
      String str = (String)localIterator.next();
      localArrayList.add((Class)implementedMechanisms.get(str));
    }
  }

  public static void registerSASLMechanism(String paramString, Class paramClass)
  {
    implementedMechanisms.put(paramString, paramClass);
  }

  public static void supportSASLMechanism(String paramString)
  {
    mechanismsPreferences.add(0, paramString);
  }

  public static void supportSASLMechanism(String paramString, int paramInt)
  {
    mechanismsPreferences.add(paramInt, paramString);
  }

  public static void unregisterSASLMechanism(String paramString)
  {
    implementedMechanisms.remove(paramString);
    mechanismsPreferences.remove(paramString);
  }

  public static void unsupportSASLMechanism(String paramString)
  {
    mechanismsPreferences.remove(paramString);
  }

  // ERROR //
  public String authenticate(String paramString1, String paramString2, String paramString3)
    throws XMPPException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 4
    //   3: getstatic 40	org/jivesoftware/smack/SASLAuthentication:mechanismsPreferences	Ljava/util/List;
    //   6: invokeinterface 194 1 0
    //   11: astore 5
    //   13: aload 5
    //   15: invokeinterface 200 1 0
    //   20: ifne +172 -> 192
    //   23: aload 4
    //   25: ifnull +318 -> 343
    //   28: getstatic 35	org/jivesoftware/smack/SASLAuthentication:implementedMechanisms	Ljava/util/Map;
    //   31: aload 4
    //   33: invokeinterface 212 2 0
    //   38: checkcast 214	java/lang/Class
    //   41: astore 10
    //   43: iconst_1
    //   44: anewarray 214	java/lang/Class
    //   47: astore 11
    //   49: aload 11
    //   51: iconst_0
    //   52: ldc 2
    //   54: aastore
    //   55: aload 10
    //   57: aload 11
    //   59: invokevirtual 240	java/lang/Class:getConstructor	([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;
    //   62: astore 12
    //   64: iconst_1
    //   65: anewarray 4	java/lang/Object
    //   68: astore 13
    //   70: aload 13
    //   72: iconst_0
    //   73: aload_0
    //   74: aastore
    //   75: aload_0
    //   76: aload 12
    //   78: aload 13
    //   80: invokevirtual 246	java/lang/reflect/Constructor:newInstance	([Ljava/lang/Object;)Ljava/lang/Object;
    //   83: checkcast 248	org/jivesoftware/smack/sasl/SASLMechanism
    //   86: putfield 78	org/jivesoftware/smack/SASLAuthentication:currentMechanism	Lorg/jivesoftware/smack/sasl/SASLMechanism;
    //   89: aload_0
    //   90: getfield 78	org/jivesoftware/smack/SASLAuthentication:currentMechanism	Lorg/jivesoftware/smack/sasl/SASLMechanism;
    //   93: aload_1
    //   94: aload_0
    //   95: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   98: invokevirtual 251	org/jivesoftware/smack/Connection:getServiceName	()Ljava/lang/String;
    //   101: aload_2
    //   102: invokevirtual 254	org/jivesoftware/smack/sasl/SASLMechanism:authenticate	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    //   105: aload_0
    //   106: monitorenter
    //   107: aload_0
    //   108: getfield 256	org/jivesoftware/smack/SASLAuthentication:saslNegotiated	Z
    //   111: ifne +21 -> 132
    //   114: aload_0
    //   115: getfield 258	org/jivesoftware/smack/SASLAuthentication:saslFailed	Z
    //   118: istore 16
    //   120: iload 16
    //   122: ifne +10 -> 132
    //   125: aload_0
    //   126: ldc2_w 90
    //   129: invokevirtual 114	java/lang/Object:wait	(J)V
    //   132: aload_0
    //   133: monitorexit
    //   134: aload_0
    //   135: getfield 258	org/jivesoftware/smack/SASLAuthentication:saslFailed	Z
    //   138: ifeq +162 -> 300
    //   141: aload_0
    //   142: getfield 260	org/jivesoftware/smack/SASLAuthentication:errorCondition	Ljava/lang/String;
    //   145: ifnull +129 -> 274
    //   148: new 87	XMPPException
    //   151: dup
    //   152: new 262	java/lang/StringBuilder
    //   155: dup
    //   156: ldc_w 264
    //   159: invokespecial 265	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   162: aload 4
    //   164: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   167: ldc_w 271
    //   170: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   173: aload_0
    //   174: getfield 260	org/jivesoftware/smack/SASLAuthentication:errorCondition	Ljava/lang/String;
    //   177: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   180: invokevirtual 274	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   183: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   186: athrow
    //   187: astore 9
    //   189: aload 9
    //   191: athrow
    //   192: aload 5
    //   194: invokeinterface 204 1 0
    //   199: checkcast 206	java/lang/String
    //   202: astore 6
    //   204: getstatic 35	org/jivesoftware/smack/SASLAuthentication:implementedMechanisms	Ljava/util/Map;
    //   207: aload 6
    //   209: invokeinterface 277 2 0
    //   214: ifeq -201 -> 13
    //   217: aload_0
    //   218: getfield 76	org/jivesoftware/smack/SASLAuthentication:serverMechanisms	Ljava/util/Collection;
    //   221: aload 6
    //   223: invokeinterface 282 2 0
    //   228: ifeq -215 -> 13
    //   231: aload 6
    //   233: astore 4
    //   235: goto -212 -> 23
    //   238: astore 14
    //   240: aload_0
    //   241: monitorexit
    //   242: aload 14
    //   244: athrow
    //   245: astore 8
    //   247: aload 8
    //   249: invokevirtual 285	java/lang/Exception:printStackTrace	()V
    //   252: new 287	org/jivesoftware/smack/NonSASLAuthentication
    //   255: dup
    //   256: aload_0
    //   257: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   260: invokespecial 289	org/jivesoftware/smack/NonSASLAuthentication:<init>	(Lorg/jivesoftware/smack/Connection;)V
    //   263: aload_1
    //   264: aload_2
    //   265: aload_3
    //   266: invokevirtual 291	org/jivesoftware/smack/NonSASLAuthentication:authenticate	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   269: astore 7
    //   271: aload 7
    //   273: areturn
    //   274: new 87	XMPPException
    //   277: dup
    //   278: new 262	java/lang/StringBuilder
    //   281: dup
    //   282: ldc_w 293
    //   285: invokespecial 265	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   288: aload 4
    //   290: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   293: invokevirtual 274	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   296: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   299: athrow
    //   300: aload_0
    //   301: getfield 256	org/jivesoftware/smack/SASLAuthentication:saslNegotiated	Z
    //   304: ifeq +13 -> 317
    //   307: aload_0
    //   308: aload_3
    //   309: invokespecial 295	org/jivesoftware/smack/SASLAuthentication:bindResourceAndEstablishSession	(Ljava/lang/String;)Ljava/lang/String;
    //   312: astore 7
    //   314: goto -43 -> 271
    //   317: new 287	org/jivesoftware/smack/NonSASLAuthentication
    //   320: dup
    //   321: aload_0
    //   322: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   325: invokespecial 289	org/jivesoftware/smack/NonSASLAuthentication:<init>	(Lorg/jivesoftware/smack/Connection;)V
    //   328: aload_1
    //   329: aload_2
    //   330: aload_3
    //   331: invokevirtual 291	org/jivesoftware/smack/NonSASLAuthentication:authenticate	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   334: astore 15
    //   336: aload 15
    //   338: astore 7
    //   340: goto -69 -> 271
    //   343: new 287	org/jivesoftware/smack/NonSASLAuthentication
    //   346: dup
    //   347: aload_0
    //   348: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   351: invokespecial 289	org/jivesoftware/smack/NonSASLAuthentication:<init>	(Lorg/jivesoftware/smack/Connection;)V
    //   354: aload_1
    //   355: aload_2
    //   356: aload_3
    //   357: invokevirtual 291	org/jivesoftware/smack/NonSASLAuthentication:authenticate	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   360: astore 7
    //   362: goto -91 -> 271
    //   365: astore 17
    //   367: goto -235 -> 132
    //
    // Exception table:
    //   from	to	target	type
    //   28	107	187	XMPPException
    //   134	187	187	XMPPException
    //   242	245	187	XMPPException
    //   274	336	187	XMPPException
    //   107	120	238	finally
    //   125	132	238	finally
    //   132	134	238	finally
    //   240	242	238	finally
    //   28	107	245	java/lang/Exception
    //   134	187	245	java/lang/Exception
    //   242	245	245	java/lang/Exception
    //   274	336	245	java/lang/Exception
    //   125	132	365	java/lang/InterruptedException
  }

  // ERROR //
  public String authenticate(String paramString1, String paramString2, org.apache.harmony.javax.security.auth.callback.CallbackHandler paramCallbackHandler)
    throws XMPPException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore 4
    //   3: getstatic 40	org/jivesoftware/smack/SASLAuthentication:mechanismsPreferences	Ljava/util/List;
    //   6: invokeinterface 194 1 0
    //   11: astore 5
    //   13: aload 5
    //   15: invokeinterface 200 1 0
    //   20: ifne +175 -> 195
    //   23: aload 4
    //   25: ifnull +305 -> 330
    //   28: getstatic 35	org/jivesoftware/smack/SASLAuthentication:implementedMechanisms	Ljava/util/Map;
    //   31: aload 4
    //   33: invokeinterface 212 2 0
    //   38: checkcast 214	java/lang/Class
    //   41: astore 9
    //   43: iconst_1
    //   44: anewarray 214	java/lang/Class
    //   47: astore 10
    //   49: aload 10
    //   51: iconst_0
    //   52: ldc 2
    //   54: aastore
    //   55: aload 9
    //   57: aload 10
    //   59: invokevirtual 240	java/lang/Class:getConstructor	([Ljava/lang/Class;)Ljava/lang/reflect/Constructor;
    //   62: astore 11
    //   64: iconst_1
    //   65: anewarray 4	java/lang/Object
    //   68: astore 12
    //   70: aload 12
    //   72: iconst_0
    //   73: aload_0
    //   74: aastore
    //   75: aload_0
    //   76: aload 11
    //   78: aload 12
    //   80: invokevirtual 246	java/lang/reflect/Constructor:newInstance	([Ljava/lang/Object;)Ljava/lang/Object;
    //   83: checkcast 248	org/jivesoftware/smack/sasl/SASLMechanism
    //   86: putfield 78	org/jivesoftware/smack/SASLAuthentication:currentMechanism	Lorg/jivesoftware/smack/sasl/SASLMechanism;
    //   89: aload_0
    //   90: getfield 78	org/jivesoftware/smack/SASLAuthentication:currentMechanism	Lorg/jivesoftware/smack/sasl/SASLMechanism;
    //   93: aload_1
    //   94: aload_0
    //   95: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   98: invokevirtual 299	org/jivesoftware/smack/Connection:getHost	()Ljava/lang/String;
    //   101: aload_3
    //   102: invokevirtual 302	org/jivesoftware/smack/sasl/SASLMechanism:authenticate	(Ljava/lang/String;Ljava/lang/String;Lorg/apache/harmony/javax/security/auth/callback/CallbackHandler;)V
    //   105: aload_0
    //   106: monitorenter
    //   107: invokestatic 97	java/lang/System:currentTimeMillis	()J
    //   110: lstore 14
    //   112: aload_0
    //   113: getfield 256	org/jivesoftware/smack/SASLAuthentication:saslNegotiated	Z
    //   116: ifne +19 -> 135
    //   119: aload_0
    //   120: getfield 258	org/jivesoftware/smack/SASLAuthentication:saslFailed	Z
    //   123: ifne +12 -> 135
    //   126: invokestatic 97	java/lang/System:currentTimeMillis	()J
    //   129: lload 14
    //   131: lcmp
    //   132: iflt +109 -> 241
    //   135: aload_0
    //   136: monitorexit
    //   137: aload_0
    //   138: getfield 258	org/jivesoftware/smack/SASLAuthentication:saslFailed	Z
    //   141: ifeq +172 -> 313
    //   144: aload_0
    //   145: getfield 260	org/jivesoftware/smack/SASLAuthentication:errorCondition	Ljava/lang/String;
    //   148: ifnull +139 -> 287
    //   151: new 87	XMPPException
    //   154: dup
    //   155: new 262	java/lang/StringBuilder
    //   158: dup
    //   159: ldc_w 264
    //   162: invokespecial 265	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   165: aload 4
    //   167: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   170: ldc_w 271
    //   173: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   176: aload_0
    //   177: getfield 260	org/jivesoftware/smack/SASLAuthentication:errorCondition	Ljava/lang/String;
    //   180: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   183: invokevirtual 274	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   186: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   189: athrow
    //   190: astore 8
    //   192: aload 8
    //   194: athrow
    //   195: aload 5
    //   197: invokeinterface 204 1 0
    //   202: checkcast 206	java/lang/String
    //   205: astore 6
    //   207: getstatic 35	org/jivesoftware/smack/SASLAuthentication:implementedMechanisms	Ljava/util/Map;
    //   210: aload 6
    //   212: invokeinterface 277 2 0
    //   217: ifeq -204 -> 13
    //   220: aload_0
    //   221: getfield 76	org/jivesoftware/smack/SASLAuthentication:serverMechanisms	Ljava/util/Collection;
    //   224: aload 6
    //   226: invokeinterface 282 2 0
    //   231: ifeq -218 -> 13
    //   234: aload 6
    //   236: astore 4
    //   238: goto -215 -> 23
    //   241: aload_0
    //   242: invokestatic 97	java/lang/System:currentTimeMillis	()J
    //   245: lload 14
    //   247: lsub
    //   248: invokestatic 110	java/lang/Math:abs	(J)J
    //   251: invokevirtual 114	java/lang/Object:wait	(J)V
    //   254: goto -142 -> 112
    //   257: astore 17
    //   259: goto -147 -> 112
    //   262: astore 13
    //   264: aload_0
    //   265: monitorexit
    //   266: aload 13
    //   268: athrow
    //   269: astore 7
    //   271: aload 7
    //   273: invokevirtual 285	java/lang/Exception:printStackTrace	()V
    //   276: new 87	XMPPException
    //   279: dup
    //   280: ldc_w 304
    //   283: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   286: athrow
    //   287: new 87	XMPPException
    //   290: dup
    //   291: new 262	java/lang/StringBuilder
    //   294: dup
    //   295: ldc_w 293
    //   298: invokespecial 265	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   301: aload 4
    //   303: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   306: invokevirtual 274	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   309: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   312: athrow
    //   313: aload_0
    //   314: getfield 256	org/jivesoftware/smack/SASLAuthentication:saslNegotiated	Z
    //   317: ifeq -41 -> 276
    //   320: aload_0
    //   321: aload_2
    //   322: invokespecial 295	org/jivesoftware/smack/SASLAuthentication:bindResourceAndEstablishSession	(Ljava/lang/String;)Ljava/lang/String;
    //   325: astore 16
    //   327: aload 16
    //   329: areturn
    //   330: new 87	XMPPException
    //   333: dup
    //   334: ldc_w 306
    //   337: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   340: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   28	107	190	XMPPException
    //   137	190	190	XMPPException
    //   266	269	190	XMPPException
    //   287	327	190	XMPPException
    //   241	254	257	java/lang/InterruptedException
    //   107	137	262	finally
    //   241	254	262	finally
    //   264	266	262	finally
    //   28	107	269	java/lang/Exception
    //   137	190	269	java/lang/Exception
    //   266	269	269	java/lang/Exception
    //   287	327	269	java/lang/Exception
  }

  // ERROR //
  public String authenticateAnonymously()
    throws XMPPException
  {
    // Byte code:
    //   0: aload_0
    //   1: new 68	org/jivesoftware/smack/sasl/SASLAnonymous
    //   4: dup
    //   5: aload_0
    //   6: invokespecial 312	org/jivesoftware/smack/sasl/SASLAnonymous:<init>	(Lorg/jivesoftware/smack/SASLAuthentication;)V
    //   9: putfield 78	org/jivesoftware/smack/SASLAuthentication:currentMechanism	Lorg/jivesoftware/smack/sasl/SASLMechanism;
    //   12: aload_0
    //   13: getfield 78	org/jivesoftware/smack/SASLAuthentication:currentMechanism	Lorg/jivesoftware/smack/sasl/SASLMechanism;
    //   16: aconst_null
    //   17: aconst_null
    //   18: ldc_w 314
    //   21: invokevirtual 254	org/jivesoftware/smack/sasl/SASLMechanism:authenticate	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    //   24: aload_0
    //   25: monitorenter
    //   26: aload_0
    //   27: getfield 256	org/jivesoftware/smack/SASLAuthentication:saslNegotiated	Z
    //   30: ifne +21 -> 51
    //   33: aload_0
    //   34: getfield 258	org/jivesoftware/smack/SASLAuthentication:saslFailed	Z
    //   37: istore 5
    //   39: iload 5
    //   41: ifne +10 -> 51
    //   44: aload_0
    //   45: ldc2_w 315
    //   48: invokevirtual 114	java/lang/Object:wait	(J)V
    //   51: aload_0
    //   52: monitorexit
    //   53: aload_0
    //   54: getfield 258	org/jivesoftware/smack/SASLAuthentication:saslFailed	Z
    //   57: ifeq +72 -> 129
    //   60: aload_0
    //   61: getfield 260	org/jivesoftware/smack/SASLAuthentication:errorCondition	Ljava/lang/String;
    //   64: ifnull +54 -> 118
    //   67: new 87	XMPPException
    //   70: dup
    //   71: new 262	java/lang/StringBuilder
    //   74: dup
    //   75: ldc_w 318
    //   78: invokespecial 265	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   81: aload_0
    //   82: getfield 260	org/jivesoftware/smack/SASLAuthentication:errorCondition	Ljava/lang/String;
    //   85: invokevirtual 269	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   88: invokevirtual 274	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   91: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   94: athrow
    //   95: astore_1
    //   96: new 287	org/jivesoftware/smack/NonSASLAuthentication
    //   99: dup
    //   100: aload_0
    //   101: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   104: invokespecial 289	org/jivesoftware/smack/NonSASLAuthentication:<init>	(Lorg/jivesoftware/smack/Connection;)V
    //   107: invokevirtual 320	org/jivesoftware/smack/NonSASLAuthentication:authenticateAnonymously	()Ljava/lang/String;
    //   110: astore_2
    //   111: aload_2
    //   112: areturn
    //   113: astore_3
    //   114: aload_0
    //   115: monitorexit
    //   116: aload_3
    //   117: athrow
    //   118: new 87	XMPPException
    //   121: dup
    //   122: ldc_w 304
    //   125: invokespecial 104	XMPPException:<init>	(Ljava/lang/String;)V
    //   128: athrow
    //   129: aload_0
    //   130: getfield 256	org/jivesoftware/smack/SASLAuthentication:saslNegotiated	Z
    //   133: ifeq +12 -> 145
    //   136: aload_0
    //   137: aconst_null
    //   138: invokespecial 295	org/jivesoftware/smack/SASLAuthentication:bindResourceAndEstablishSession	(Ljava/lang/String;)Ljava/lang/String;
    //   141: astore_2
    //   142: goto -31 -> 111
    //   145: new 287	org/jivesoftware/smack/NonSASLAuthentication
    //   148: dup
    //   149: aload_0
    //   150: getfield 80	org/jivesoftware/smack/SASLAuthentication:connection	Lorg/jivesoftware/smack/Connection;
    //   153: invokespecial 289	org/jivesoftware/smack/NonSASLAuthentication:<init>	(Lorg/jivesoftware/smack/Connection;)V
    //   156: invokevirtual 320	org/jivesoftware/smack/NonSASLAuthentication:authenticateAnonymously	()Ljava/lang/String;
    //   159: astore 4
    //   161: aload 4
    //   163: astore_2
    //   164: goto -53 -> 111
    //   167: astore 6
    //   169: goto -118 -> 51
    //
    // Exception table:
    //   from	to	target	type
    //   0	26	95	java/io/IOException
    //   53	95	95	java/io/IOException
    //   116	161	95	java/io/IOException
    //   26	39	113	finally
    //   44	51	113	finally
    //   51	53	113	finally
    //   114	116	113	finally
    //   44	51	167	java/lang/InterruptedException
  }

  void authenticated()
  {
    monitorenter;
    try
    {
      this.saslNegotiated = true;
      super.notify();
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  void authenticationFailed()
  {
    authenticationFailed(null);
  }

  void authenticationFailed(String paramString)
  {
    monitorenter;
    try
    {
      this.saslFailed = true;
      this.errorCondition = paramString;
      super.notify();
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  void bindingRequired()
  {
    monitorenter;
    try
    {
      this.resourceBinded = true;
      super.notify();
      monitorexit;
      return;
    }
    finally
    {
      localObject = finally;
      monitorexit;
      throw localObject;
    }
  }

  void challengeReceived(String paramString)
    throws IOException
  {
    this.currentMechanism.challengeReceived(paramString);
  }

  public boolean hasAnonymousAuthentication()
  {
    return this.serverMechanisms.contains("ANONYMOUS");
  }

  public boolean hasNonAnonymousAuthentication()
  {
    int i;
    if ((!(this.serverMechanisms.isEmpty())) && (((this.serverMechanisms.size() != 1) || (!(hasAnonymousAuthentication())))))
      i = 1;
    while (true)
    {
      return i;
      i = 0;
    }
  }

  protected void init()
  {
    this.saslNegotiated = false;
    this.saslFailed = false;
    this.resourceBinded = false;
    this.sessionSupported = false;
  }

  public boolean isAuthenticated()
  {
    return this.saslNegotiated;
  }

  public void send(Packet paramPacket)
  {
    this.connection.sendPacket(paramPacket);
  }

  void sessionsSupported()
  {
    this.sessionSupported = true;
  }

  void setAvailableSASLMethods(Collection<String> paramCollection)
  {
    this.serverMechanisms = paramCollection;
  }
}